GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a7d869...2b73a7 )
by Stefano
02:46
created

build.js ➔ make_red   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
var program = require('commander');
2
var shell = require('shelljs');
3
var chalk = require('chalk');
4
var emoji = require('node-emoji');
5
var co = require('co');
6
var prompt = require('co-prompt');
7
8
var enviroment = process.env.npm_package_config_enviroment;
9
10
shell.mkdir('-p',['applications/assets/icons']);
11
12
process.stdout.write(chalk.gray(emoji.emojify('[  ] Build Server Vagrant (' + enviroment + ")\n")));
13
14
if ( enviroment === 'dev' ){
15
16
  vagrantId = shell.exec("vagrant global-status | grep d1b0server | awk '{ print $1}'", {silent:true});
0 ignored issues
show
Bug introduced by
The variable vagrantId seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.vagrantId.
Loading history...
17
18
  var vagrantCode;
19
  if ( vagrantId.code !== 0 ){
20
    process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Errore: "+vagrantId.stderr+ " - "+vagrantId.output)));
21
    process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
22
  } else {
23
    vagrantCode = vagrantId.output.trim();
24
  }
25
26
  if ( !vagrantCode ) {
27
    process.stdout.write(chalk.yellow(emoji.emojify("[:raised_hand: ] Vagrant server not found \n")));
28
29
    shell.exec('./scripts/generatekey.sh');
30
    shell.exec('./scripts/generateSSL.sh');
31
    shell.exec('./scripts/roles_update.sh');
32
33
    shell.cd('server/');
34
35
    upVagrant = shell.exec("vagrant up", {silent:true});
0 ignored issues
show
Bug introduced by
The variable upVagrant seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.upVagrant.
Loading history...
36
    if ( upVagrant.code !== 0 ){
37
      process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Errore: "+upVagrant.stderr+ " - "+upVagrant.output)));
38
      process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
39
    }
40
41
    process.stdout.write("Vagrant server UP.\n");
42
43
44
    shell.echo('Install Server Required Package and Config');
45
    ansibleProc = shell.exec('ansible-playbook -i '+enviroment+'.hosts site.yml', {silent:true});
0 ignored issues
show
Bug introduced by
The variable ansibleProc seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.ansibleProc.
Loading history...
46
    if ( ansibleProc.code !== 0 ){
47
      process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Errore ansible site.yml")));
48
      process.stderr.write(chalk.gray(ansibleProc.stdout+"\n"));
49
      process.stderr.write(chalk.red(ansibleProc.stderr+"\n"));
50
51
      process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
52
    }
53
54
    process.stdout.write(chalk.bgGreen.black(emoji.emojify('[:heavy_check_mark: ] Vagrant server installation packages completed.' + "\n")));
55
56
    shell.cd('..');
57
58
  } else {
59
    process.stdout.write(chalk.gray(emoji.emojify("[:world_map: ] Find vagrant server: "+vagrantCode+". Skip creation.\n" )));
60
    // non funziona vagrant up by name or uuid
61
    // var upVagrant = shell.exec("vagrant up "+vagrantCode);
62
63
    shell.cd('server/');
64
65
    upVagrant = shell.exec("vagrant up", {silent:true});
66
    if ( upVagrant.code !== 0 ){
67
      process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Errore ansible site.yml")));
68
      process.stderr.write(chalk.gray(ansibleProc.stdout+"\n"));
0 ignored issues
show
Bug introduced by
The variable ansibleProc seems to be never declared. If this is a global, consider adding a /** global: ansibleProc */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
69
      process.stderr.write(chalk.red(ansibleProc.stderr+"\n"));
70
      process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
71
    }
72
73
    process.stdout.write(chalk.bgGreen.black(emoji.emojify('[:heavy_check_mark: ] Vagrant server UP!' + "\n")));
74
75
    shell.cd('..');
76
  }
77
78
} else {
79
80
    shell.echo('Install Server Required Package and Config');
81
    ansibleProc = shell.exec('ansible-playbook -i '+enviroment+'.hosts site.yml', {silent:true});
82
    if ( ansibleProc.code !== 0 ){
83
      process.stderr.write(chalk.bgRed.white(emoji.emojify("[:heavy_multiplication_x: ] Errore: "+ansibleProc.stderr+ " - "+ansibleProc.output)));
84
      process.exit(1);
0 ignored issues
show
Compatibility Debugging Code Best Practice introduced by
Use of process.exit() is discouraged as it will potentially stop the complete node.js application. Consider quitting gracefully instead by throwing an Error.
Loading history...
85
    }
86
87
}
88